package com.zimmur.app.mocolink.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zimmur.app.mocolink.dao.UserMoneyLogMapper;
import com.zimmur.app.mocolink.domain.model.UserMoneyLog;
import com.zimmur.app.mocolink.domain.param.UserMoneyLogParam;
import com.zimmur.app.mocolink.domain.util.PageUtil;
import com.zimmur.app.mocolink.service.IUserMoneyLogService;

@Service
public class UserMoneyLogServiceImpl implements IUserMoneyLogService {

	@Autowired
	private UserMoneyLogMapper userMoneyLogMapper;
	
	@Override
	public int add(UserMoneyLog moneyLog) {
		return userMoneyLogMapper.insertSelective(moneyLog);
	}

	@Override
	public PageUtil<UserMoneyLog> selectByParam(UserMoneyLogParam param) {
		PageUtil<UserMoneyLog> page = new PageUtil<>();
		List<UserMoneyLog> list = userMoneyLogMapper.selectByParam(param);
		int count = userMoneyLogMapper.countByParam(param);
		page.setPageNo(param.getPageNo());
		page.setPageSize(param.getPageSize());
		page.setItemList(list);
		page.setTotalRecord(count);
		return page;
	}

}
